//    Copyright (C) Kherty.  All rights reserved.
using System.Diagnostics.Contracts;
using System.Reflection;
using System.Windows;

namespace OpenLS.UI
{
    class OfficeUIResourceKey: ResourceKey
    {
        public override Assembly Assembly
        {
            get { return CachedAssembly; }
        }

        static OfficeUIResourceKey()
        {
            CachedAssembly = typeof (Ribbon).Assembly;
            AssemblyHashCode = CachedAssembly.GetHashCode();
        }
        private static readonly Assembly CachedAssembly ;
        private static readonly int AssemblyHashCode;
        public OfficeUIResourceKey(OfficeUIResourceId resourceId)
        {
            _resourceId = resourceId;
        }

        readonly OfficeUIResourceId _resourceId; 

        public override int GetHashCode()
        {
            return AssemblyHashCode + (int)_resourceId;
        }
        public override bool Equals(object obj)
        {
            if (obj == this)
                return true;
            OfficeUIResourceKey key = obj as OfficeUIResourceKey;
            if (key == null)
                return false;
            Contract.Assert(key.Assembly == Assembly);
            return key._resourceId == _resourceId;
        }
        public override string ToString()
        {
            return base.ToString() + " " + _resourceId;
        }
    }
}
